<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			
			// javascript 
			// 基于对象 不是面向对象
			
			// 方式1
			var stu1 = new Object();
			stu1.name = "张三";
			stu1.age = 18;
			console.log(stu1.name +"," + stu1.age);
			
			// 方式2
			var stu2 = {
				name : "李四",
				age : 18
			}
			console.log(stu2.name +"," + stu2.age);
			
			// 嵌套
			var stu3 = {
				name : "王五",
				age : 18,
				dog :{
					name: "阿黄"
				},
				friends: ["张三","李四"],
				sleep()
				{
					console.log(this.name+":zzzzz");
				},
				eat:function()
				{
					console.log(this.name+":吃晚饭");
				}
			}
			console.log(stu3.name+","+stu3.dog.name);
			stu3.sleep();
			stu3.eat();
			
			
		
			
		</script>
	</body>
</html>